# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=postr
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.13.1
pkgrel=1
arch=('any')
pkgdesc="Upload photos to Flickr (mingw-w64)"
options=(strip staticlibs)
depends=("${MINGW_PACKAGE_PREFIX}-python2-pygtk")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "gnome-doc-utils")
options=('strip' 'staticlibs')
license=("GPL 2")
url="https://www.gnome.org"
source=(https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz
        001-win.patch)
sha256sums=('8b004d108ebe18e0399f8a20282f129a3c8c9b6615322479d0e01918c6b42fbc'
            '7f963d3703a7e0fc678622a69961a6dabb00af050086520fd122fdcc37fbc292')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  patch -p1 -i ${srcdir}/001-win.patch

  AUTOPOINT='intltoolize --automake --copy' autoreconf -f -i
}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/share/pkgconfig" \
  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
  rm ${pkgdir}/postrExtension.py
}
